<template>
  <view class="shorthand-container">
    <navbar title="速记口诀"></navbar>
    <view class="top_bg"></view>
    <view class="shorthand-item" v-for="(item,i) in list" :key="i" @click="itemAction(item)">
      <image class="shorthand-icon" :src="item.img"></image>
      <view class="flex v f1">
        <text class="shorthand-title">{{ item.title }}</text>
        <text class="shorthand-sub-title">{{ item.count || 0 }}</text>
      </view>
      <image class="shorthand-arrow" src="/static/shorthand/arrow.png"></image>
    </view>
  </view>
</template>

<script>
import navbar from "../../components/navbar";
import {shorthandApi} from "../../api";

export default {
  components: {navbar},
  data() {
    return {
      list: []
    }
  },
  async onLoad(query) {
    const res = await shorthandApi.list()
    this.list = res.data.data.list
  },
  methods: {
    itemAction(item) {
      uni.navigateTo({
        url: `/pages/shorthand_detail/shorthand_detail?id=${item.id}&title=${item.title}&count=${item.count || 0}`
      })
    }
  }
}
</script>

<style lang="scss">
page {
  background-color: #f4f3fb;
}
::v-deep .top-bar.white {
  background-color: transparent;
}
.top_bg {
  background-image: url("@/static/top_bg.png");
  width: 750rpx;
  height: 624rpx;
  position: absolute;
  top: 0;
  left: 0;
  background-size: cover;
}
.shorthand-container {
  display: flex;
  flex-direction: column;
  .shorthand-item {
    display: flex;
    height: 127upx;
    align-items: center;
    border-bottom: 1px double #F2F2F2;
    background-color: #fff;
    z-index: 1;
    border-radius: 32rpx;
    margin-top: 24rpx;
    margin-left: 32rpx;
    margin-right: 32rpx;
  }

  .shorthand-icon {
    width: 68upx;
    height: 68upx;
    margin-left: 28upx;
  }

  .shorthand-title {
    color: #000000;
    font-size: 15px;
    margin-left: 30upx;
  }

  .shorthand-sub-title {
    color: #A0A0A0;
    font-size: 30upx;
    margin-left: 30upx;
  }

  .shorthand-arrow {
    width: 48upx;
    height: 48upx;
    margin-right: 32upx;
  }
}

</style>
